package com.ctgu.A1_4;

public class Product {
    //商品项（Product）具有名称（title）、重量(weight)和描述（description）价格(price)，并具有getPriceForQuantity()方法和getWeight（）方法；
    private String title;
    private double weight;
    private String description;
    private double price;

    public double getPriceForQuantity(int quantity) {
        return price * quantity;
    }
    @Override
    public String toString() {
        return "商品{" +
                "名称='" + title + '\'' +
                ", 重量=" + weight +
                ", 描述='" + description + '\'' +
                ", 价格=" + price +
                '}';
    }

    public Product() {
    }

    public Product(String title, double weight, String description, double price) {
        this.title = title;
        this.weight = weight;
        this.description = description;
        this.price = price;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}
